﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="QuerySelectionLabelingTool.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style3
        {
        }
        .style4
        {
            width: 138px;
        }
        .style5
        {
            width: 128px;
        }
        .style6
        {
            width: 161px;
        }
        .style7
        {
            height: 21px;
        }
        .style8
        {
            height: 21px;
            width: 208px;
        }
        .style9
        {
            height: 21px;
            width: 180px;
        }
        .style10
        {
            height: 21px;
            width: 186px;
        }
    </style>
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    My Task<br />
    <br />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="taskID" DataSourceID="SqlDataSourceMyTask" Width="766px" 
        AllowPaging="True" ondatabound="GridView2_DataBound" 
        PageSize="20">
    <Columns>
        <asp:BoundField DataField="name" HeaderText="Task Name" SortExpression="name" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:BoundField DataField="Incomplete" HeaderText="Incomplete" ReadOnly="True" 
            SortExpression="Incomplete" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:BoundField DataField="Total" HeaderText="Total" ReadOnly="True" 
            SortExpression="Total" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:BoundField HeaderText="Status">
        <ItemStyle HorizontalAlign="Center" Width="100px" />
        </asp:BoundField>
        <asp:HyperLinkField DataNavigateUrlFields="taskID" 
            DataNavigateUrlFormatString="EvaluateQueries.aspx?taskID={0}" Text="Start" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
        </asp:HyperLinkField>
        <asp:HyperLinkField DataNavigateUrlFields="taskID" 
            DataNavigateUrlFormatString="PreAndRe.aspx?taskID={0}" Text="Scorecard" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
        </asp:HyperLinkField>
    </Columns>
    <EmptyDataTemplate>
        <table style="border-style: groove; width:100%;" border="1" rules="all">
            <tr>
                <td class="style6" align="center">
                    TaskName</td>
                <td class="style4" align="center">
                    Incomplete</td>
                <td class="style5" align="center">
                    Total</td>
            </tr>
            <tr>
                <td class="style3" colspan="3" align="center">
                    No Task</td>
            </tr>
        </table>
    </EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSourceMyTask" runat="server" 
    ConnectionString="<%$ ConnectionStrings:QuerySelectionLabelingToolConnectionString %>" 
    
        
        SelectCommand="SELECT tb_task.ID AS taskID, tb_task.name, tb_IncomNewsCount.Incomplete, tb_allNewsCount.Total FROM tb_task INNER JOIN (SELECT taskID, COUNT(*) AS Total FROM (SELECT taskID, newsID FROM tb_experiments WHERE (userID = @userID) GROUP BY taskID, newsID) AS tb_news1 GROUP BY taskID) AS tb_allNewsCount ON tb_allNewsCount.taskID = tb_task.ID LEFT OUTER JOIN (SELECT taskID, COUNT(*) AS Incomplete FROM (SELECT taskID, newsID AS ImcompleteNews FROM tb_experiments AS tb_experiments_1 WHERE (userID = @userID) AND (isComplete = 0) GROUP BY taskID, newsID) AS tb_news2 GROUP BY taskID) AS tb_IncomNewsCount ON tb_allNewsCount.taskID = tb_IncomNewsCount.taskID ORDER BY tb_IncomNewsCount.Incomplete DESC">
    <SelectParameters>
        <asp:SessionParameter Name="userID" SessionField="userID" />
    </SelectParameters>
</asp:SqlDataSource>
<br />
    <br />
    <br />
    All Task<br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="taskID" DataSourceID="SqlDataSourceAllTask" Width="769px" 
        AllowPaging="True" ondatabound="GridView1_DataBound" 
        PageSize="20" onrowcommand="GridView1_RowCommand" onload="GridView1_Load">
        <Columns>
            <asp:BoundField DataField="name" HeaderText="Task Name" SortExpression="name" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="createTime" HeaderText="Task Create Time" 
                SortExpression="createTime" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Incomplete" HeaderText="Incomplete" 
                ReadOnly="True" SortExpression="Incomplete" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Total" HeaderText="Total" ReadOnly="True" 
                SortExpression="Total" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:HyperLinkField DataNavigateUrlFields="taskID" 
                DataNavigateUrlFormatString="LabelingResult.aspx?taskID={0}" 
                Text="Labeling Result" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
            </asp:HyperLinkField>
            <asp:HyperLinkField DataNavigateUrlFields="taskID" 
                DataNavigateUrlFormatString="PreAndRe.aspx?taskID={0}" Text="Scorecard" >
            <ItemStyle Width="100px" HorizontalAlign="Center" />
            </asp:HyperLinkField>
            <asp:HyperLinkField DataNavigateUrlFields="taskID" 
                DataNavigateUrlFormatString="ViewQuery.aspx?taskID={0}&amp;newsIndex=0" 
                Text="View Queries" >
            <ItemStyle HorizontalAlign="Center" Width="100px" />
            </asp:HyperLinkField>
            <asp:TemplateField HeaderText="PingBing" ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false"
                        CommandArgument='<%# Eval("taskID") %>' CommandName="PingBing"
                        onclick="LinkButton1_Click" 
                        onclientclick="" Text="Ping Bing"></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle Width="100px" HorizontalAlign="Center" />
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <table border="1" style="border-style: groove; width:100%;" rules="all">
                <tr>
                    <td align="center" class="style9">
                        Task Name</td>
                    <td align="center" class="style8">
                        Task Create Time</td>
                    <td align="center" class="style10">
                        Incomplete</td>
                    <td align="center" class="style7">
                        Total</td>
                </tr>
                <tr>
                    <td align="center" colspan="4">
                        No Task</td>
                </tr>
            </table>
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceAllTask" runat="server" 
        ConnectionString="<%$ ConnectionStrings:QuerySelectionLabelingToolConnectionString %>" 
        
        
        SelectCommand="SELECT tb_task.ID AS taskID, tb_task.name, tb_task.createTime, tb_IncomNewsCount.Incomplete, tb_allNewsCount.Total FROM tb_task INNER JOIN (SELECT taskID, COUNT(*) AS Total FROM (SELECT taskID, newsID FROM tb_experiments GROUP BY taskID, newsID) AS tb_news1 GROUP BY taskID) AS tb_allNewsCount ON tb_allNewsCount.taskID = tb_task.ID LEFT OUTER JOIN (SELECT taskID, COUNT(*) AS Incomplete FROM (SELECT taskID, newsID AS ImcompleteNews FROM tb_experiments AS tb_experiments_1 WHERE (isComplete = 0) GROUP BY taskID, newsID) AS tb_news2 GROUP BY taskID) AS tb_IncomNewsCount ON tb_allNewsCount.taskID = tb_IncomNewsCount.taskID ORDER BY tb_task.createTime DESC">
    </asp:SqlDataSource>
    <br />
    </asp:Content>
